/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "forma_cobro", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FormaCobro.findAll", query = "SELECT f FROM FormaCobro f"),
    @NamedQuery(name = "FormaCobro.findByFcobCod", query = "SELECT f FROM FormaCobro f WHERE f.fcobCod = :fcobCod"),
    @NamedQuery(name = "FormaCobro.findByFcobDescri", query = "SELECT f FROM FormaCobro f WHERE f.fcobDescri = :fcobDescri")})
public class FormaCobro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "fcob_cod", nullable = false)
    private Integer fcobCod;
    @Size(max = 20)
    @Column(name = "fcob_descri", length = 20)
    private String fcobDescri;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "formacobrofcobcod")
    private Collection<CobDetalle> cobDetalleCollection;
    @OneToMany(mappedBy = "fcobCod")
    private Collection<Cobro> cobroCollection;

    public FormaCobro() {
    }

    public FormaCobro(Integer fcobCod) {
        this.fcobCod = fcobCod;
    }

    public Integer getFcobCod() {
        return fcobCod;
    }

    public void setFcobCod(Integer fcobCod) {
        this.fcobCod = fcobCod;
    }

    public String getFcobDescri() {
        return fcobDescri;
    }

    public void setFcobDescri(String fcobDescri) {
        this.fcobDescri = fcobDescri;
    }

    @XmlTransient
    public Collection<CobDetalle> getCobDetalleCollection() {
        return cobDetalleCollection;
    }

    public void setCobDetalleCollection(Collection<CobDetalle> cobDetalleCollection) {
        this.cobDetalleCollection = cobDetalleCollection;
    }

    @XmlTransient
    public Collection<Cobro> getCobroCollection() {
        return cobroCollection;
    }

    public void setCobroCollection(Collection<Cobro> cobroCollection) {
        this.cobroCollection = cobroCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (fcobCod != null ? fcobCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FormaCobro)) {
            return false;
        }
        FormaCobro other = (FormaCobro) object;
        if ((this.fcobCod == null && other.fcobCod != null) || (this.fcobCod != null && !this.fcobCod.equals(other.fcobCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.FormaCobro[ fcobCod=" + fcobCod + " ]";
    }
    
}
